# Maintainer: David Runge <dvzrv@archlinux.org>

_name=sphinx-click
pkgname=python-sphinx-click
pkgver=5.1.0
pkgrel=1
pkgdesc="Sphinx plugin to automatically document click-based applications"
arch=(any)
url="https://github.com/click-contrib/sphinx-click"
license=(MIT)
depends=(
  python
  python-click
  python-docutils
  python-sphinx
)
makedepends=(
  python-build
  python-installer
  python-pbr
  python-setuptools
  python-wheel
)
checkdepends=(
  python-pytest
  python-click
)
source=($_name-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz)
sha512sums=('0e6d93c052692874e39e01b6dea5bae7730d9d86a24a1b2811d4bbf1030d1640a1deba7a52cf002bbaa2f81155df119da91153a2f9f0487163b0276c3c8e0f8f')
b2sums=('16ff01887348ad4f7cda90e63dd5f614b7020010c49428f0d5da8c29528cab8b66607c95e124bb7a171c482f53309eb673ee87dd0495b24e84f158b46b4fbd3c')

build() {
  cd $_name-$pkgver
  PBR_VERSION=$pkgver python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 docs/*.rst -t "$pkgdir/usr/share/doc/$pkgname/docs/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
